<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/server.js" type="text/javascript" charset="utf-8"></script>
   <script src="js/layer/layer.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="panel admin-panel" id="app">
  <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 添加公告</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="">      
      <div class="form-group">
        <div class="label">
          <label>标题：</label>
        </div>
        <div class="field">
        
          <div class="tips" >
      
           <input type="text" style="background-color: white;"  class="input"  v-model="notice.title"/>
        
          </div>
        </div>
      </div>

  
      <div class="form-group" >
        <div class="label">
          <label>内容：</label>
        </div>
        <div class="field">
         
          <div class="tips" name="content">
         
          	  <textarea type="text"   class="input" name="note" style="height:120px;background-color: white;" v-model="notice.content"></textarea>
          </div>
        </div>
      </div>
         <div class="form-group">
			        <div class="label">
			          <label></label>
			        </div>
			        <div class="field">
			          <button class="button bg-main icon-check-square-o" type="button" v-on:click="add"> 提交</button>
			        </div>
			      </div>
    </form>
  </div>
</div>
</body>


<script type="text/javascript">

	
	//Hint表示提示对象 ，把提示信息封装到hint对象中
	var vue = new Vue({
		el : '#app',
		data : {
			notice:{
				title:'',
				content:''
			},
			web_server:window.web_server,
			web_static_server:this.web_server+"/static/"
		},
		methods : {
			add : function() {
				var _self = this;
					 $.ajax({
		           	url: _self.web_server+"/notice/insert",
              		method: 'POST',
                 	data: _self.notice,
                 	dataType:'json',
                 	success: function(result) {
                    	layer.msg(result.message);
                    	if(result.code=="200"){
                    		_self.notice.title='';
                    		_self.notice.content='';
                    	}
                    	
                	},
                 	error: function (jqXHR) {
                 	 layer.msg("发生错误");
                     console.log(JSON.stringify(jqXHR));
                	}
            	});
				
			}

		}

	});

</script>



</html>